<script setup>
import news from '@/assets/data/news'

const route = useRoute()
const id = route.params.id
const article = news.find(item => item.id === Number(id))
</script>

<template>
  <div class="wrapper">
    <!-- 标题 -->
    <h1 class="title">{{ article.title }}</h1>
    <div class="date">{{ article.date }}</div>
    <!-- 内容 -->
    <section v-html="article.content"></section>
  </div>
</template>

<style scoped lang="less">
.wrapper {
  .title {
    font-size: 24px;
    font-weight: bold;
    margin: 0 auto 10px;
  }
  .date {
    text-align: center;
    font-size: 14px;
    color: #999;
  }
}
section {
  margin-top: 20px;
  font-size: 18px;
  font-family: '宋体';
  text-indent: 2em;
  line-height: 1.5em;
  :deep(p) {
    margin-bottom: 1rem;
  }
}
</style>
